<?php
namespace frontend\controllers;

use frontend\behaviors\ApiAuthBehaviors;
use yii\rest\Controller;
use yii\web\Response;

/**
 * Created by PhpStorm.
 * User: huyang
 * Date: 2018/4/28
 * Time: 下午6:03
 */
class BaseController extends Controller
{
    public function behaviors()
    {
        $behaviors = parent::behaviors();

        $behaviors['contentNegotiator']['formats'] = ['application/json' => Response::FORMAT_JSON];
        $behaviors['authenticator']['authMethods'] = [
            'class' => ApiAuthBehaviors::class,
        ];

        return $behaviors;
    }
}